﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Web.UI;
using EasyLibrary.AR;

namespace EasyFrota_Mobile
{
    public partial class SiteMaster : MasterPage
    {
        protected bool isAdministrator;
        protected bool isAuthenticated;
        protected bool isManager;
        protected bool isUser;

        protected void Page_Init(object sender, EventArgs e)
        {
            if (Session.IsNewSession)
            {
                Session["logged_in"] = "no";
                Response.Redirect("~/Default.aspx", true);
                return;
            }

            isAuthenticated = Session["logged_in"] != null && Session["logged_in"].Equals("yes");
            isAdministrator = Session["Administrador"] != null && Session["Administrador"].Equals("True");
            Session["LastActivity"] = DateTime.Now;
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session.Keys.Count > 0)
            {
                DataSet myDataSet = new DataSet();
                ActiveRecord ar = null;
                if (isAuthenticated)
                {
                   // myDataSet = ar.executeCommandOnDataSet("EXEC UtilizadorInfo " + Session["IDUtilizadores"]);
                    utilizador.Text = "Bem vindo" + " : " + Session["User"];
                }
            }
        }
    }
}